target
Type
function
Summary
Returns the object which received the message that started execution.
Syntax
the target
target()
Description
Use the target function within a message handler to determine which object originally received the message.
Suppose a card script contains a mouseDown handler. If the user clicks a button, a mouseDown message is sent to the button. If the button's script does not contain a mouseDown handler, the message is passed to the card, and handled by the card's mouseDown handler.
The target function is similar to the me keyword. In the example described above, within the card's handler, the target function returns the button's name, because the button is the object that first received the mouseDown message. However, the me keyword is a reference to the card, because the card is the object whose script contains the mouseDown handler that is executing.
Examples
the target
if word 1 of the target is "button" then clickedAButton
set the backgroundColor of the target to "black"
Related
control structure: function
function: dragSource, dragDestination, selectedObject
glossary: return, property, handle, handler, execute, pass, message, card, keyword, object reference, object
message: mouseDown
Compatibility and Support
Introduced
LiveCode 1.0
OS
mac
windows
linux
ios
android
Platforms
desktop
server
mobile